#ifndef CAMERA_HPP
#define CAMERA_HPP

#include "common_include.hpp"
#include "stereo_undistort.hpp"
#include "transfer.hpp"

#define sample_buffer_size 5

class Camera{
    public:
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
        typedef std::shared_ptr<Camera> Ptr;

        Camera();
        ~Camera();
        
        int pic_index_;

        void SetStereoUndistort(std::shared_ptr<Stereo_Undistort> stereo_undistort){stereo_undistort_ = stereo_undistort;}

    private:
        void CameraStop();
        void CameraSampleLoop();

        std::thread camera_thread_;
        std::mutex data_mutex_; 
        std::atomic<bool> camera_running_;

        ofstream cam_outfile;

        unsigned char           * g_pRgbBuffer_left[sample_buffer_size];     //处理后数据缓存区
        unsigned char           * g_pRgbBuffer_right[sample_buffer_size];     //处理后数据缓存区


        int sample_buffer_index_;

        int                     iCameraCounts;
        int                     iStatus;
        tSdkCameraDevInfo       tCameraEnumList;
        int                     hCamera;
        tSdkCameraCapbility     tCapability;      //设备描述信息
        tSdkFrameHead           sFrameInfo;
        tSdkFrameHead           sFrameInfo_left;
        tSdkFrameHead           sFrameInfo_right;
        BYTE*			        pbyBuffer;
        int                     iDisplayFrames;
        IplImage *iplImage;
        int                     channel;
        double                     exposure_time;
        
        std::shared_ptr<Stereo_Undistort> stereo_undistort_ = nullptr;

};


#endif

